/*
 * NewJFrame.java
 *
 * Created on May 16, 2008, 10:55 AM
 */

package ca.jerg.app;

import ca.jerg.wizard.*;

/**
 *
 * @author  dave
 */
public class jErg extends javax.swing.JFrame {

    /*
     * Set to native Look & Feel
     */
	{
		try 
		{
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} 
		catch ( Exception e )
		{
			e.printStackTrace();
		}
	}
	
    /** Creates new form NewJFrame */
    public jErg() {
		eswl = new ErgSettingsWorkLoad();
		eswt = new ErgSettingsWorkTime();
		esrt = new ErgSettingsRestTime();
		esd = new ErgSettingsDescriptions();
		
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("jErg");

        jMenu1.setText("File");

        jMenu4.setText("New");

        jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem6.setText("Quick Workout");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quickWorkoutAction(evt);
            }
        });
        jMenu4.add(jMenuItem6);

        jMenu1.add(jMenu4);
        jMenu1.add(jSeparator1);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem1.setText("Exit");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitAction(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Settings");

        jMenuItem2.setText("Work Loads");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                workLoadAction(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuItem3.setText("Work Times");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                workTimeAction(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuItem4.setText("Rest Times");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                restTimeAction(evt);
            }
        });
        jMenu2.add(jMenuItem4);

        jMenuItem5.setText("Descriptions");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                descriptionAction(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Help");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 275, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void workLoadAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_workLoadAction
	if ( eswl.isShowing() == false )
	{
		eswl = new ErgSettingsWorkLoad();
		eswl.setVisible(true);
	}
	else
	{
		eswl.toFront();
		eswl.requestFocus();
	}
}//GEN-LAST:event_workLoadAction

private void workTimeAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_workTimeAction
	if ( eswt.isShowing() == false )
	{
		eswt = new ErgSettingsWorkTime();
		eswt.setVisible(true);
	}
	else
	{
		eswt.toFront();
		eswt.requestFocus();
	}
}//GEN-LAST:event_workTimeAction

private void restTimeAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restTimeAction
	if ( esrt.isShowing() == false )
	{
		esrt = new ErgSettingsRestTime();
		esrt.setVisible(true);
	}
	else
	{
		esrt.toFront();
		esrt.requestFocus();
	}
}//GEN-LAST:event_restTimeAction

private void descriptionAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_descriptionAction
	if ( esd.isShowing() == false )
	{
		esd = new ErgSettingsDescriptions();
		esd.setVisible(true);
	}
	else
	{
		esd.toFront();
		esd.requestFocus();
	}
}//GEN-LAST:event_descriptionAction

private void quickWorkoutAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quickWorkoutAction
	ErgWizard ew = new ErgWizard();
	ew.showWizard();
}//GEN-LAST:event_quickWorkoutAction

private void exitAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitAction
	System.exit(0);
}//GEN-LAST:event_exitAction

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jErg().setVisible(true);
            }
        });
    }
	
	private ErgSettingsWorkLoad eswl;
	private ErgSettingsWorkTime eswt;
	private ErgSettingsRestTime esrt;
	private ErgSettingsDescriptions esd;
	
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JSeparator jSeparator1;
    // End of variables declaration//GEN-END:variables

}
